package com.smforj.ssm.modules.eslib.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.smforj.ssm.frame.core.dao.impl.BaseDaoSupport;
import com.smforj.ssm.frame.core.enums.JDataSource;
import com.smforj.ssm.frame.core.utils.BeanUtils;
import com.smforj.ssm.modules.eslib.dao.CirculationLogDao;
import com.smforj.ssm.modules.eslib.domain.CirculationLog;
import com.smforj.ssm.modules.lib.constant.ADataSource;

@Repository
@JDataSource(ADataSource.SLAVE1)
public class CirculationLogDaoImpl extends BaseDaoSupport<CirculationLog> implements CirculationLogDao {

	@Override
	public int insertCirculationLog(CirculationLog cirLog) { 
		Map<String, Object> params = BeanUtils.toMap(cirLog);
		return getSqlSessionTemplate().insert(getSqlName("insertCirculationLog"), params);
	}

	@Override
	public int updateCirculationLog(String jsrbh, String barcode, Double fj) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("jsrbh", jsrbh);
		params.put("barcode", barcode);
		params.put("fj", fj);
		return getSqlSessionTemplate().update(getSqlName("updateCirculationLog"), params);
	}

	@Override
	public List<CirculationLog> selectCirculationLogByJsrbh(String jsrbh) { 
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("jsrbh", jsrbh); 
		return getSqlSessionTemplate().selectList(getSqlName("selectCirculationLogByJsrbh"), params);
	}
 

}
